package com.xxx.mapper;/**
 * @author zhanzhongxin
 * @date 2021/8/13 14:14
 * @version v1.0
 * @description
 */

import com.xxx.pojo.Orders;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @Description:
 */
@CacheNamespace
public interface OrderMapper {
    @Select("select o.id,o.user_id,o.amount from orders o")
    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "amount", property = "amount"),
            @Result(property = "user", column = "user_id", one = @One(select = "com.xxx.mapper.UserMapper.queryUserById", fetchType = FetchType.EAGER))
    }
    )
    public List<Orders> queryOrderUser();

    public List<Orders> queryOrderUserDetail();
}
